/**
 * Created by mapbar_front on 2019/8/6.
 */
import React,{Component} from 'react';

function handleClick(ref){
    console.log('ref',ref.current);
}

const FancyButton = React.forwardRef((props,ref)=>(
    <button ref={ref} onClick={()=>handleClick(ref)}>
        {props.children}
    </button>
))

class Ref11 extends Component{
    constructor(props){
        super(props);
        this.ref = React.createRef();
    }
    render(){
        return(
            <div>
                <FancyButton ref={this.ref}>
                    点击
                </FancyButton>
            </div>
        )
    }
}
export default Ref11;

